<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
</head>
<body>
    修改学生信息
    <form action="${pageContext.request.contextPath}/student" method="post">
        <input type="hidden" name="id" value="${student.id}">
        学生姓名： <input type="text" name="name" required value="${student.name}">
        <br>
        性别： <input type="radio" name="gender" value="0" ${student.gender == 0?'checked':''}>女
        <input type="radio" name="gender" value="1" ${student.gender == 1?'checked':''}>男
        <br>
        生日： <input type="date" name="birthday" required value="${student.birthday}">
        <br>
        老师：
        <select name="teacher">
            <c:forEach items="${teachers}" var="teacher">
                <c:if test="${student.teacher == teacher.id}">
                    <option selected value="${teacher.id}">${teacher.name}</option>
                </c:if>
                <c:if test="${student.teacher != teacher.id}">
                    <option value="${teacher.id}">${teacher.name}</option>
                </c:if>
            </c:forEach>
        </select>

        <br>
        班级：
        <select name="classId" >
            <c:forEach items="${classes}" var="myclass">
                <c:if test="${student.classId == myclass.id}">
                    <option selected value="${myclass.id}">${myclass.name}</option>
                </c:if>
                <c:if test="${student.classId != myclass.id}">
                    <option value="${myclass.id}">${myclass.name}</option>
                </c:if>
            </c:forEach>
        </select>
        <br>
        <button type="submit" >提交</button> <label class="error">${msg}</label>
    </form>
</body>
</html>
